#include <stdio.h>
#include <string>
#include <vector>
#include "sigslot/sigslot.h"

class Light : public sigslot::has_slots<>
{
   public:
    void turnLight(int arg, std::string say)
    {
        printf("turnLight arg %d say %s\n", arg, say.c_str());
    }
    void turnLight(int arg0, int arg1, std::string say)
    {
        printf("turnLight arg %d - %d say %s\n", arg0, arg1, say.c_str());
    }
    void turnLight(int arg0, int arg1, std::string say0, std::string say1)
    {
        printf("turnLight arg %d - %d say %s - %s \n", arg0, arg1, say0.c_str(), say0.c_str());
    }
};

class Switch
{
   public:
    sigslot::signal2<int, std::string> click0;
    sigslot::signal3<int, int, std::string> click1;
    sigslot::signal4<int, int, std::string, std::string> click2;
};

class TestSlot
{
   public:
    void setUp();
    void run();
    void tearDown();
};
void TestSlot::setUp()
{
    printf("--- TestSlot::setUp \n");
}

void TestSlot::run()
{
    Light mLight;
    Switch mSwitch;

    mSwitch.click0.connect(&mLight, &Light::turnLight);
    mSwitch.click1.connect(&mLight, &Light::turnLight);
    mSwitch.click2.connect(&mLight, &Light::turnLight);

    std::string hey = "key from slot";
    mSwitch.click0.emit(1, hey);
    mSwitch.click1.emit(1, 2, hey);
    mSwitch.click2.emit(1, 2, hey, hey);

    mSwitch.click0.disconnect_all();
    mSwitch.click1.disconnect_all();
    mSwitch.click2.disconnect_all();
}

void TestSlot::tearDown()
{
    printf("--- TestSlot::tearDown \n\n");
}

int main()
{

    TestSlot testSlot;
    testSlot.setUp();
    testSlot.run();
    testSlot.tearDown();
    return 0;
}
